var a = getApp(), t = 2 * a.globalData.statusBarHeight + 20;

Page({
    data: {
        statusBarHeight: t,
        page: 1
    },
    onLoad: function(a) {
        a.id && this.setData({
            id: a.id
        }), a.questionnaire_id && this.setData({
            questionnaire_id: a.questionnaire_id
        }), this._detail();
    },
    back: function() {
        wx.navigateBack({
            delta: 1
        });
    },
    onReady: function() {},
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {
        if (!(this.data.current_page >= this.data.last_page)) {
            var a = 1 + this.data.page;
            this.setData({
                page: a
            });
        }
    },
    onShareAppMessage: function() {},
    getMoreData: function() {
        var t = this, e = a.getNetAddresss("plugin.questionnaire.api.index.indexInfo");
        a._getNetWork({
            url: e,
            data: {
                details: "details",
                record_id: t.data.id,
                questionnaire_id: t.data.questionnaire_id,
                page: t.data.page
            },
            success: function(a) {
                var e = a.data;
                console.log(e), 1 == e.result ? t.setData({
                    choice: t.data.choice.concat(e.data.details.choice.data),
                    record: e.data.details.record.answers,
                    current_page: e.data.details.choice.current_page,
                    last_page: e.data.details.choice.last_page,
                    title: e.data.details.record.has_one_questionnaire.title
                }) : wx.showToast({
                    icon: "none",
                    title: e.msg,
                    duration: 1500
                });
            },
            fail: function(a) {
                console.log(a);
            }
        });
    },
    _detail: function(t) {
        var e = this, i = a.getNetAddresss("plugin.questionnaire.api.index.indexInfo");
        a._getNetWork({
            url: i,
            data: {
                details: "details",
                record_id: e.data.id,
                questionnaire_id: e.data.questionnaire_id,
                page: e.data.page
            },
            success: function(a) {
                var t = a.data;
                console.log(t), 1 == t.result ? e.setData({
                    choice: t.data.details.choice,
                    record: t.data.details.record.answers,
                    current_page: t.data.details.choice.current_page,
                    last_page: t.data.details.choice.last_page,
                    title: t.data.details.record.has_one_questionnaire.title
                }) : wx.showToast({
                    icon: "none",
                    title: t.msg,
                    duration: 1500
                });
            },
            fail: function(a) {
                console.log(a);
            }
        });
    }
});